package com.service;

import com.domain.Goodsetting;
import com.domain.result.ResultData;
import com.mapper.primary.GoodsettingMapper;
import com.service.seinterface.GoodSettingService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class GoodSettingServiceImpl implements GoodSettingService {
    @Resource
    GoodsettingMapper goodsettingMapper;
    @Override
    public ResultData getAllGoodSetting() {
        ResultData resultData = new ResultData();
        resultData.setData(goodsettingMapper.selectAll());
        return resultData;
    }

    @Override
    public ResultData updateGoodSettingById(Integer goodsettingid, String key_value) {
        ResultData resultData = new ResultData();
        int count=goodsettingMapper.updateGoodSettingById(goodsettingid,key_value);
        return resultData;
    }

    @Override
    public ResultData updateGoodSettingById(List<Goodsetting> goodsettings) {
        ResultData resultData = new ResultData();
        for(Goodsetting goodsetting:goodsettings){
            int count=goodsettingMapper.updateGoodSettingByKey(goodsetting.getKeyName(),goodsetting.getKeyValue());
        }
        return resultData;
    }
}
